//
//  TTProgressCell.m
//  Estate
//
//  Created by houzhen on 2018/9/5.
//  Copyright © 2018年 ttsx. All rights reserved.
//

#import "TTProgressCell.h"

@implementation TTProgressCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUpView];
    }
    return self;
}
-(void)setUpView{
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(10, 40, DEF_SCREEN_WIDTH-20, 10)];
    view.layer.masksToBounds = YES;
    view.layer.cornerRadius = 5;
    view.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:view];

    self.progressView = [[ASProgressPopUpView alloc]initWithFrame:CGRectMake(10, 40, [UIScreen mainScreen].bounds.size.width-20, 10)];
    
    self.progressView.progress = 0.0;
    self.progressView.popUpViewAnimatedColors = @[TTTheme.defaultManger.defaultColor,TTTheme.defaultManger.defaultColor];
    
    self.progressView.font = [UIFont systemFontOfSize:16];
    self.progressView.dataSource = self;
    [self.contentView addSubview:self.progressView];
    [self.progressView showPopUpViewAnimated:YES];
}
- (NSString *)progressView:(ASProgressPopUpView *)progressView stringForProgress:(float)progress
{
    return [NSString stringWithFormat:@"%.0f%%",progress*100];
}

// required to calculate the default size for the popUpView
// simply list all the custom strings that will be displayed
- (NSArray *)allStringsForProgressView:(ASProgressPopUpView *)progressView;
{
    return @[@"Just starting", @"About halfway", @"Nearly there", @"Complete"];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
